home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / include / sys / file.h < prev    next >
C/C++ Source or Header  |  1996-04-09  |  2KB  |  86 lines

  1. /*    @(#)file.h 1.1 86/07/07 SMI; from UCB 6.2 83/09/23    */
  2.  
  3. #ifndef __FILE_HEADER__
  4. #define __FILE_HEADER__
  5.  
  6. #include <fcntl.h>
  7.  
  8. #ifdef KERNEL
  9. /*
  10.  * Descriptor table entry.
  11.  * One for each kernel object.
  12.  */
  13. struct    file {
  14.     int    f_flag;        /* see below */
  15.     long    stamp;        /* validation stamp */
  16.     short    f_type;        /* descriptor type */
  17.     short    f_count;    /* reference count */
  18.     short    f_msgcount;    /* references from message queue */
  19.     struct    fileops {
  20.         int    (*fo_rw)();
  21.         int    (*fo_ioctl)();
  22.         int    (*fo_select)();
  23.         int    (*fo_close)();
  24.     } *f_ops;
  25.     caddr_t    f_data;        /* ptr to file specific struct (vnode/socket) */
  26.     off_t    f_offset;
  27. };
  28.  
  29. /*** Don't appear to need these - MMH 
  30.     struct    file *file, *fileNFILE;
  31.     int    nfile;
  32. ****/
  33.  
  34. struct    file *getf();
  35. struct    file *falloc();
  36. #endif /* KERNEL */
  37.  
  38. /*
  39.  * flags - see also fcntl.h
  40.  */
  41. #define    FOPEN        (-1)
  42. #define    FREAD        00001        /* descriptor read/receive'able */
  43. #define    FWRITE        00002        /* descriptor write/send'able */
  44. #define    FMARK        00020        /* mark during gc() */
  45. #define    FDEFER        00040        /* defer for next gc pass */
  46. #define    FSHLOCK        00200        /* shared lock present */
  47. #define    FEXLOCK        00400        /* exclusive lock present */
  48.  
  49. /* bits to save after open */
  50. #define    FMASK        00113
  51. #define    FCNTLCANT    (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK)
  52.  
  53. /*
  54.  * User definitions.
  55.  */
  56.  
  57. /*
  58.  * Flock call.
  59.  */
  60. #define    LOCK_SH        1    /* shared lock */
  61. #define    LOCK_EX        2    /* exclusive lock */
  62. #define    LOCK_NB        4    /* don't block when locking */
  63. #define    LOCK_UN        8    /* unlock */
  64.  
  65. /*
  66.  * Lseek call.
  67.  */
  68. #define    L_SET        0    /* absolute offset */
  69. #define    L_INCR        1    /* relative to current offset */
  70. #define    L_XTND        2    /* relative to end of file */
  71.  
  72. #ifdef KERNEL
  73. #define    GETF(fp, fd) { \
  74.     if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
  75.         u.u_error = EBADF; \
  76.         return; \
  77.     } \
  78. }
  79.  
  80. #define    DTYPE_VNODE    1    /* file */
  81. #define    DTYPE_SOCKET    2    /* communications endpoint */
  82.  
  83. #endif /* KERNEL */
  84.  
  85. #endif /* __FILE_HEADER__ */
  86.